//
//  AccountView.m
//  budgetplan
//
//  Created by Barak on 10/27/12.
//  Copyright (c) 2012 Barak. All rights reserved.
//

#import "AccountView.h"

@implementation AccountView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        
    }
    return self;
}


- (void) setAccount:(Account *)account {
    _account = account;
    
    NSMutableArray* values = [[NSMutableArray alloc] init];
    NSNumber* totalBudget;
    for (BudgetRule* rule in account.budgetRules) {
        if ([rule.category isEqualToString:@"Total budget"]) {
            totalBudget = rule.budgetLimit;
        } else {
            [values addObject:rule.utilization];
        }
    }
//    _budgetUtilizationBar.total = [totalBudget doubleValue];
//    
//    //_budgetUtilizationBar.sectionsValues = @[@23, @14, @8, @11, @31];
//    _budgetUtilizationBar.sectionsValues = values;
//    [_budgetUtilizationBar update];
    
    [self performSelector:@selector(refreshFromServer) withObject:nil afterDelay:5];
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
